import Dispatch
import Foundation
import SwiftyBeaver

CXCrashMgr.shared.registerCrash()

let defaultPort = _isDebugAssertConfiguration() ? 7777 : 7777

// Xcode控制台日志
let console = ConsoleDestination()
console.format = "$Dyyyy-MM-dd HH:mm:ss.SSS$d $C$L$c $N.$F:$l - $M"

// 默认swiftybeaver.log文件日志
let file = FileDestination()
file.logFileURL = URL(fileURLWithPath: "\(Bundle.main.bundlePath)/Server.log")
file.format = console.format

let log = SwiftyBeaver.self
log.addDestination(console)
log.addDestination(file)

let logFile = file.logFileURL?.absoluteString
log.debug("日志文件路径:\(logFile!)")

CXConfigMgr.shared.create()

CXHttpMgr.shared.getBSphpSeSsL(appId: 10000)

let server = CXServer()
log.debug("Server Start and listening to \(defaultPort)")
server.listen(port: UInt32(defaultPort))
log.debug("Server End and Closed")
